package com.usian.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.usian.mapper.AccountMapper;
import com.usian.pojo.Account;
import com.usian.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AccountServiceImpl implements AccountService {

    @Autowired
    private AccountMapper accountMapper;

    @Override
    public void DeductionAmount(Account account) {
        accountMapper.updateById(account);
    }

    @Override
    public Account findByUserId(Integer userId) {

        LambdaQueryWrapper<Account> lambdaQueryWrapper =new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(Account::getUserId,userId);
        Account account = accountMapper.selectOne(lambdaQueryWrapper);
        return account;
    }
}
